﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Microsoft.Office.Tools.Ribbon;
using Vsto = Microsoft.Office.Tools;
using System.Windows.Forms;

namespace PowerPointAddIn3
{
    public partial class Ribbon1 : OfficeRibbon
    {
        public Ribbon1()
        {
            InitializeComponent();
        }

        private void Ribbon1_Load(object sender, RibbonUIEventArgs e)
        {

        }

        private void toggleButton1_Click(object sender, RibbonControlEventArgs e)
        {
            OpenFileDialog dlg = new OpenFileDialog();
            dlg.Filter = "ppt files (*.ppt)|*.ppt|pptx files|*.pptx";
            dlg.FilterIndex = 1;//如果您设置 FilterIndex 属性，则当显示对话框时，将选择该筛选器。
            dlg.RestoreDirectory = true;//取得或设定值，指出对话方块是否在关闭前还原目前的目录。

            if (dlg.ShowDialog() == DialogResult.OK)
            {
                Globals.ThisAddIn.Application.ActivePresentation.ApplyTemplate(dlg.FileName);
            }

            
            //Vsto.CustomTaskPane myBlogsPane = Globals.ThisAddIn.CustomTaskPanes.Single(ctp => ctp.Title == "My blogs");
            //myBlogsPane.Visible = toggleButton1.Checked;
        }

        private void ManageBlogBtn_Click(object sender, RibbonControlEventArgs e)
        {
            Globals.ThisAddIn.Application.ActivePresentation.ApplyTemplate("D://test.ppt");
        }
    }
}
